The present invention relates generally to computer network-based publish/subscribe messaging mechanisms. More particularly, the present invention relates to a system and method for matching a publication to at least one subscriber.
A publish/subscribe (“pub/sub”) is an asynchronous messaging mechanism where message senders (i.e., publisher or publishing client) do not send messages to specific receivers (i.e., subscriber or subscribing client). In a publish/subscribe network, any number of consumers (i.e., subscribers) of information can receive messages that are provided by one or more producers (i.e., publishers) of that information. In this case, a producer of information is called a publisher and a consumer of that information is called a subscriber.
Publish/subscribe messaging provides the concept of a topic on which any number of interested consumers of information can subscribe in order to register their interest. This is similar to the way that a person might subscribe only to magazines about topics in which they are interested. Each topic provides particular event or state information.
A publisher can send messages containing information about a particular topic to all subscribers to that topic, e.g., via a broker device, without any knowledge of how many subscribers there are, or the details of the nodes that host those subscribers. Because of this, publish/subscribe messaging completely decouples the provider of the information from the consumer of that information.
In order to facilitate this publish/subscribe capability, a broker device is required to hold information about which subscribers have subscribed to which topics and how to deliver messages to them. A publisher can then publish messages using the broker device to all subscribers on that topic without knowing the details of those subscribers. There can be multiple publishers for a particular topic, and a subscriber to information about one topic can also be a publisher of information about other topics.
The broker device is a component to which client devices (i.e., applications or systems) connect to perform publishing and subscribing of messages. The broker device handles matching of publications with subscriptions, distribution of publications to subscribing clients, and persistence (i.e., storing messages in a non-volatile storage) of messages to ensure message delivery at a quality of service required. The broker device acts as a hub for routing messages between clients, and with the aid of a bridge, other messaging servers. The broker device can store messages on behalf of a client that is not connected and make them available to the client when it reconnects. In addition, the broker device can store messages on behalf of the bridge and make them available when the messaging servers that the bridge connects to are available.
The bridge, a middleware in a publish/subscribe messaging system, is an extension of the broker device that routes messages between the broker device and other messaging servers to form sophisticated messaging topologies. The bridge allows messages to be routed between the broker device and messaging servers.
The bridge can route messages between one or more messaging servers. If the bridge cannot connect to a messaging server, messages destined for the messaging server can be stored by the broker device. When the messaging server becomes available, the bridge will connect to it and transfer the stored messages. In addition, the bridge can transfer pending messages from the messaging server to the broker device.
Typically, each type of messaging server supports its own messaging protocol and its own message formats. The bridge plays the role of routing messages across different protocols and transforming messages to a format acceptable by each messaging server.
A matching engine is a sub-component of the broker device that matches a publication to a subscriber. A wildcarded topic is a way of a subscriber matching a number of potential topics in a subscription. A wildcard is typically a special identifier or indication, e.g., a character specified in the subscription. For example, a subscription to a wildcarded topic a/* would match publications to a/b, a/c and so on, since the character means “anything on this hierarchy level” i.e. in this case “a/<anything>”. A non-wildcarded topic is a topic with specific identifiers at each level in a hierarchy, e.g., a subscription to a/b will match only publications including the topic a/b.
In a traditional publish/subscribe system, when a subscriber registers its interest in a topic (i.e., a subscription) into a broker device, the broker device records the subscriber and the topic of interest. When a message is published into the broker device, the broker device invokes the matching engine to determine which subscribers subscribe a topic of the published message. For example, a message published to topic a/b would be matched to any subscribers subscribing to topic a/b.
However, the traditional publish/subscribe system becomes delayed when there is a subscriber subscribing the wildcarded topic. For example, the traditional publish/subscribe system delays yielding a non-wildcarded match until yielding a wildcarded match is completed. The wildcarded match refers to a subscriber who specified his/her subscription using a wildcard character, e.g., *, #, and whose subscription encompass a plurality of topics. The non-wildcarded match refers to a subscriber whose subscription exactly matches with a topic on a publication.
Thus, it is desirable to provide a method and a system for efficiently and/or fast matching of a publication to at least one subscriber.